Skip to content

Fix: make the docs build strict without suppressions - #1546

Merged
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
ChaoWao:fix/strict-docs-and-annotations
Jul 28, 2026
Merged

Fix: make the docs build strict without suppressions#1546
ChaoWao merged 1 commit into
hw-native-sys:mainfrom
ChaoWao:fix/strict-docs-and-annotations

Conversation

@ChaoWao

@ChaoWao ChaoWao commented Jul 28, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two gaps left the docs build weaker than it looked. After this, mkdocs build --strict passes with zero warnings and nothing suppressed.

1. The nav rule was unenforceable

docs/README.md (from #1525) states that a new doc needs a nav entry in mkdocs.yml. I tested that claim and it was not enforced: a page absent from nav built cleanly under --strict, surfacing as a single INFO line, so a missing entry silently dropped the page out of the site's navigation.

validation.nav.omitted_files: warn now makes --strict fail on it. Verified both ways — a page left out of nav fails the build, and removing it passes again.

26 existing pages are out of nav on purpose and are declared in not_in_nav rather than switching the check off:

Group Count Why
investigations/* 16 An accumulating log, reached via investigations/README.md
remote-l3-worker-design/* 6 A design set, reached from its landing page
troubleshooting/device-error-codes/* 4 Per-code pages, reached from the code table

Listing every entry would bury the rest of the tree; declaring them keeps the check strict for everything else.

2. The griffe suppression is now unnecessary

#1543 shipped docs/_hooks/griffe_filter.py purely to keep one message — "No type or annotation for parameter" — from failing --strict. Its own docstring said "Remove this hook once the annotations land." All nine are annotated here, so the hook is deleted. Warning count is 0 with no filter in place.

Bonus: the generated signatures now carry types — device_id: int, log_level: int | None, config: CallConfig | None — instead of bare names.

Two annotations needed a decision, not a transcription

This is why I did not do it in #1543 as a mechanical pass:

  • ChipWorker.init's binsAny. The docstring accepts "any object exposing host_path / aicpu_path / …", and the body reads dispatcher_path through getattr. Naming RuntimeBinaries would be both narrower than the actual contract and a dependency from simpler onto simpler_setup — the wrong direction per project-layout.md.
  • ChipWorker.run's handleCallableHandle, imported under TYPE_CHECKING. The runtime import is deliberately lazy at its use site (task_interface.py:1157, with a # noqa: PLC0415), so a module-level import would undo that on purpose-avoided grounds. Both files already have from __future__ import annotations, so the annotations cost no import at all.

Verification

  • mkdocs build --strict → exit 0, 0 warnings, 98 pages, with griffe_filter.py removed
  • nav enforcement tested in both directions (omitted page fails; clean tree passes)
  • The 9 griffe warnings went from 9 → 0
  • Generated signatures confirmed to render the new types in the built HTML
  • ruff check / ruff format --check clean; test_package_surface.py 5 passed / 1 skipped
  • No behaviour change — annotations, one config block, and one deleted build hook

Two gaps left the docs build weaker than it looked.

A page absent from nav still built cleanly under --strict, showing up as
one INFO line. So the rule docs/README.md states — a new doc needs a nav
entry — was unenforceable, and a missing entry silently dropped the page
out of the site's navigation. validation.nav.omitted_files now warns,
which --strict treats as a failure. Verified both ways: a page left out
of nav fails the build, and removing it passes again.

Twenty-six existing pages are out of nav on purpose: the investigations
log, the remote-L3 design set, and the per-code error pages are reached
through their own index pages, and listing every entry would bury the
rest of the tree. They are declared in not_in_nav so the check stays
strict for everything else rather than being switched off.

The nine parameters that griffe reported as documented-but-unannotated
are annotated, so docs/_hooks/griffe_filter.py — which existed only to
keep that one message from failing --strict — is deleted. The build now
passes --strict with zero warnings and nothing suppressed.

Two of those annotations needed a decision rather than a transcription.
ChipWorker.init's `bins` is structurally typed: the docstring accepts
any object exposing the *_path attributes, and the body reads
dispatcher_path through getattr, so it is Any. Naming RuntimeBinaries
would be both narrower than the contract and a dependency from simpler
onto simpler_setup. ChipWorker.run's `handle` is a CallableHandle,
imported under TYPE_CHECKING because the runtime import is deliberately
lazy at its use site; PEP 563 is already on in both files, so the
annotations cost no import.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 5a5dc9ce-b7a6-497d-bc52-92fc771cc087

📥 Commits

Reviewing files that changed from the base of the PR and between 723bb14 and d945680.

📒 Files selected for processing (4)
  • docs/_hooks/griffe_filter.py
  • mkdocs.yml
  • python/simpler/task_interface.py
  • python/simpler/worker.py
💤 Files with no reviewable changes (1)
  • docs/_hooks/griffe_filter.py

📝 Walkthrough

Walkthrough

MkDocs strict validation now reports omitted and missing navigation pages, while the Griffe filter hook is removed. Worker initialization and execution interfaces now include explicit type annotations with annotation-only imports where needed.

Changes

Documentation validation and worker typing

Layer / File(s) Summary
MkDocs validation configuration
mkdocs.yml, docs/_hooks/*
Adds strict navigation validation warnings, expands documented exclusions, and removes the Griffe filter hook.
Worker interface annotations
python/simpler/task_interface.py, python/simpler/worker.py
Adds explicit annotations to ChipWorker and Worker methods while preserving defaults and runtime behavior.

Estimated code review effort: 2 (Simple) | ~10 minutes

Poem

A rabbit hops through typed code,
With warnings neatly in a row.
The Griffe filter fades away,
While workers name their types today.
“Strict docs!” the bunny cries—
And bounds through annotated skies.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: making docs builds strict without suppressions.
Description check ✅ Passed The description is directly about the docs-build strictness changes and hook removals in the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ChaoWao
ChaoWao merged commit 40b6329 into hw-native-sys:main Jul 28, 2026
18 checks passed
@ChaoWao
ChaoWao deleted the fix/strict-docs-and-annotations branch July 28, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant